home *** CD-ROM | disk | FTP | other *** search
- property _me, pSelectChannel, pSelectionRect, pVThumbObj, pHThumbObj, pNArrowObj, pSArrowObj, pEArrowObj, pWArrowObj, pCopyButtonObj, pTracking, pSpanCorner, pSpanHeader, pBody, pRowHeader, pColumnHeader, pCorner, pScrollNeedsList, pOnStageRectList
- global gDBTableVarList
-
- on new me, selectChannel, SpanCorner, SpanHeader, corner, colHeader, rowHeader, body, descendant
- if objectp(descendant) then
- _me = descendant
- else
- _me = me
- end if
- pSelectChannel = selectChannel
- pBody = body
- pRowHeader = rowHeader
- pColumnHeader = colHeader
- pCorner = corner
- pSpanCorner = SpanCorner
- pSpanHeader = SpanHeader
- MyObj = getaProp(gDBTableVarList, GetObjProp())
- SpriteList = GetSpriteList(MyObj)
- controlList = GetControlList(MyObj)
- VBedSp = getaProp(SpriteList, #VBed)
- VThumbSp = getaProp(SpriteList, #VThumb)
- NArrowSp = getaProp(SpriteList, #NorthArrow)
- SArrowSp = getaProp(SpriteList, #SArrow)
- pVBedObj = getaProp(controlList, VBedSp)
- pVThumbObj = getaProp(controlList, VThumbSp)
- pNArrowObj = getaProp(controlList, NArrowSp)
- pSArrowObj = getaProp(controlList, SArrowSp)
- HBedSp = getaProp(SpriteList, #HBed)
- EArrowSp = getaProp(SpriteList, #EArrow)
- WArrowSp = getaProp(SpriteList, #WArrow)
- HThumbSp = getaProp(SpriteList, #HThumb)
- pHBedObj = getaProp(controlList, HBedSp)
- pEArrowObj = getaProp(controlList, EArrowSp)
- pWArrowObj = getaProp(controlList, WArrowSp)
- pHThumbObj = getaProp(controlList, HThumbSp)
- pSelectionRect = rect(-1, -1, -1, -1)
- pTracking = 0
- return me
- end
-
- on setSuperTable me
- setSuperTable(pBody, _me)
- setSuperTable(pRowHeader, _me)
- setSuperTable(pColumnHeader, _me)
- setSuperTable(pCorner, _me)
- return me
- end
-
- on SetPostShowProps me
- SetPostShowProps(pSpanHeader)
- SetPostShowProps(pCorner)
- SetPostShowProps(pColumnHeader)
- SetPostShowProps(pRowHeader)
- SetPostShowProps(pBody)
- MyObj = getaProp(gDBTableVarList, GetObjProp())
- controlList = GetControlList(MyObj)
- SpriteList = GetSpriteList(MyObj)
- pScrollNeedsList = GetScrollNeeds(_me)
- if getaProp(pScrollNeedsList, #v) then
- VScrollCount = GetInvisibleRowCount(pBody)
- ThumbSp = getaProp(SpriteList, #VThumb)
- theThumbLoc = the locH of sprite ThumbSp
- minPixel = the locV of sprite ThumbSp
- maxPixel = the top of sprite getaProp(SpriteList, #SArrow) - (the height of sprite ThumbSp / 2)
- resize(pVThumbObj, theThumbLoc, minPixel, maxPixel, 1, VScrollCount, 1, VScrollCount)
- end if
- if getaProp(pScrollNeedsList, #h) then
- if IsTableVisible(pSpanHeader) then
- HScrollCount = GetInvisibleColumnCount(pSpanHeader)
- else
- HScrollCount = GetInvisibleColumnCount(pBody)
- end if
- HScrollCount = max(HScrollCount, 2)
- ThumbSp = getaProp(SpriteList, #HThumb)
- theThumbLoc = the locV of sprite ThumbSp
- minPixel = the locH of sprite ThumbSp
- maxPixel = the left of sprite getaProp(SpriteList, #EArrow) - (the width of sprite ThumbSp / 2)
- resize(pHThumbObj, theThumbLoc, minPixel, maxPixel, 1, HScrollCount, 1, HScrollCount)
- end if
- pCopyButtonObj = getaProp(controlList, getaProp(SpriteList, #CopyButton))
- return me
- end
-
- on condemn me
- _me = 0
- pNArrowObj = 0
- pSArrowObj = 0
- pEArrowObj = 0
- pWArrowObj = 0
- pVThumbObj = 0
- pHThumbObj = 0
- pRowHeader = 0
- pColumnHeader = 0
- pCorner = 0
- pSpanCorner = 0
- pSpanHeader = 0
- pBody = 0
- return me
- end
-
- on CondemnList me, xList
- MaxCount = count(xList)
- repeat with rc = 1 to MaxCount
- xObj = getAt(xList, rc)
- condemn(xObj)
- setAt(xList, rc, 0)
- end repeat
- return 0
- end
-
- on Inscope me
- puppetSprite(pSelectChannel, 1)
- return me
- end
-
- on outScope me
- puppetSprite(pSelectChannel, 0)
- return me
- end
-
- on showMe me
- set the rect of sprite pSelectChannel to getVisRect(_me, pSelectionRect)
- updateStage()
- return me
- end
-
- on hideMe me
- set the rect of sprite pSelectChannel to rect(0, 0, 0, 0)
- updateStage()
- return me
- end
-
- on trackMouse me, startCell
- pTracking = 1
- resetSelection(me._me)
- c = point(-1, -1)
- currCell = startCell
- setSelectionRect(me._me, startCell, currCell)
- repeat while the mouseDown
- currCell = getCurrCell(me._me, the mouseH, the mouseV)
- if c <> currCell then
- setSelectionRect(me._me, startCell, currCell)
- set the rect of sprite pSelectChannel to getVisRect(_me, pSelectionRect)
- updateStage()
- c = currCell
- end if
- end repeat
- setSelectionRect(me._me, startCell, currCell)
- set the rect of sprite pSelectChannel to getVisRect(_me, pSelectionRect)
- updateStage()
- pTracking = 0
- if checkIfSelected(me) then
- enable(pCopyButtonObj)
- else
- disable(pCopyButtonObj)
- end if
- return me
- end
-
- on getCurrCell me, h, v
- if isAbove(pBody, v) then
- currCell = AboveBody(me, h, v)
- else
- if not isBelow(pBody, v) then
- if isLeftOf(pBody, h) then
- currCell = LevelwithBodyHMinReached(me, h, v)
- else
- if isRightOf(pBody, h) then
- if not maxReached(pHThumbObj) then
- simulateClickOn(pEArrowObj)
- end if
- currCell = getMouseCell(pBody, h, v)
- else
- currCell = getMouseCell(pBody, h, v)
- end if
- end if
- else
- if isLeftOf(pColumnHeader, h) then
- if not maxReached(pVThumbObj) then
- simulateClickOn(pSArrowObj)
- end if
- if not minReached(pHThumbObj) then
- simulateClickOn(pWArrowObj)
- currCell = getMouseCell(pBody, h, v)
- else
- mouseCell = getMouseCell(pRowHeader, h, v)
- currCell = point(0, getAt(mouseCell, 2))
- end if
- else
- if isRightOf(pBody, h) then
- if not maxReached(pVThumbObj) then
- simulateClickOn(pSArrowObj)
- end if
- if not maxReached(pHThumbObj) then
- simulateClickOn(pEArrowObj)
- end if
- currCell = getMouseCell(pBody, h, v)
- else
- if not maxReached(pVThumbObj) then
- simulateClickOn(pSArrowObj)
- end if
- currCell = getMouseCell(pBody, h, v)
- end if
- end if
- end if
- end if
- return currCell
- end
-
- on AboveBody me, h, v
- if isLeftOf(pBody, h) then
- currCell = AboveBodyVMinReached(me, h, v)
- currCell = AboveBodyHMinReached(me, h, v)
- else
- if isRightOf(pBody, h) then
- if not minReached(pVThumbObj) then
- simulateClickOn(pNArrowObj)
- currCell = getMouseCell(pBody, h, v)
- end if
- if not maxReached(pHThumbObj) then
- simulateClickOn(pEArrowObj)
- currCell = getMouseCell(pBody, h, v)
- else
- mouseCell = getMouseCell(pColumnHeader, h, v)
- currCell = point(getAt(mouseCell, 1), 0)
- end if
- else
- if not minReached(pVThumbObj) then
- simulateClickOn(pNArrowObj)
- currCell = getMouseCell(pBody, h, v)
- else
- mouseCell = getMouseCell(pColumnHeader, h, v)
- currCell = point(getAt(mouseCell, 1), 0)
- end if
- end if
- end if
- return currCell
- end
-
- on AboveBodyVMinReached me, h, v
- if not minReached(pVThumbObj) then
- simulateClickOn(pNArrowObj)
- mouseCell = getMouseCell(pRowHeader, h, v)
- currCell = point(0, getAt(mouseCell, 2))
- else
- currCell = point(0, 0)
- end if
- return currCell
- end
-
- on AboveBodyHMinReached me, h, v
- if not minReached(pHThumbObj) then
- simulateClickOn(pWArrowObj)
- mouseCell = getMouseCell(pColumnHeader, h, v)
- currCell = point(0, getAt(mouseCell, 2))
- else
- currCell = point(0, 0)
- end if
- return currCell
- end
-
- on LevelwithBodyHMinReached me, h, v
- if not minReached(pHThumbObj) then
- simulateClickOn(pWArrowObj)
- currCell = getMouseCell(pBody, h, v)
- else
- mouseCell = getMouseCell(pRowHeader, h, v)
- currCell = point(0, getAt(mouseCell, 2))
- end if
- return currCell
- end
-
- on doRollover me
- return me
- end
-
- on ScrollToStart me
- if not minReached(pVThumbObj) then
- scrollToTop(pSpanHeader)
- scrollToTop(pRowHeader)
- scrollToTop(pBody)
- end if
- if not minReached(pHThumbObj) then
- scrollToLeft(pSpanHeader)
- scrollToLeft(pColumnHeader)
- scrollToLeft(pBody)
- end if
- end
-
- on scrollUp me
- scrollUp(pBody)
- scrollUp(pRowHeader)
- if not pTracking then
- set the rect of sprite pSelectChannel to getVisRect(_me, pSelectionRect)
- end if
- updateStage()
- return me
- end
-
- on scrollDown me
- scrollDown(pRowHeader)
- scrollDown(pBody)
- if not pTracking then
- set the rect of sprite pSelectChannel to getVisRect(_me, pSelectionRect)
- end if
- updateStage()
- return me
- end
-
- on scrollLeft me
- ScrollIncrement = GetScrollLeftIncrement(pSpanHeader)
- scrollLeft(pSpanHeader, ScrollIncrement)
- scrollLeft(pColumnHeader, ScrollIncrement)
- scrollLeft(pBody, ScrollIncrement)
- if not pTracking then
- set the rect of sprite pSelectChannel to getVisRect(_me, pSelectionRect)
- end if
- updateStage()
- return me
- end
-
- on scrollRight me
- ScrollIncrement = GetScrollRightIncrement(pSpanHeader)
- if getNumColumns(pSpanHeader) > 1 then
- scrollRight(pSpanHeader, ScrollIncrement)
- end if
- scrollRight(pColumnHeader, ScrollIncrement)
- scrollRight(pBody, ScrollIncrement)
- if not pTracking then
- set the rect of sprite pSelectChannel to getVisRect(_me, pSelectionRect)
- end if
- updateStage()
- return me
- end
-
- on getTopRow me
- return getTopRow(pBody)
- end
-
- on getLeftColumn me
- return getLeftColumn(pBody)
- end
-
- on resetSelection me
- pSelectionRect = rect(-1, -1, -1, -1)
- set the rect of sprite pSelectChannel to rect(0, 0, 0, 0)
- return me
- end
-
- on setSelectionRect me, cell1, cell2
- p1 = duplicate(cell1)
- p2 = duplicate(cell2)
- if getAt(p1, 1) > getAt(p2, 1) then
- temp = getAt(p2, 1)
- setAt(p2, 1, getAt(p1, 1))
- setAt(p1, 1, temp)
- end if
- if getAt(p1, 2) > getAt(p2, 2) then
- temp = getAt(p2, 2)
- setAt(p2, 2, getAt(p1, 2))
- setAt(p1, 2, temp)
- end if
- pSelectionRect = rect(p1, p2)
- return me
- end
-
- on getVisRect me, theRect
- R = rect(0, 0, 0, 0)
- if theRect <> rect(-1, -1, -1, -1) then
- if (theRect.left > 0) and (theRect.top > 0) then
- R = getVisRect(pBody, theRect)
- end if
- if (theRect.left = 0) and (theRect.top > 0) then
- r1 = getVisRect(pRowHeader, rect(1, getAt(theRect, 2), 1, getAt(theRect, 4)))
- r2 = getVisRect(pBody, rect(1, getAt(theRect, 2), getAt(theRect, 3), getAt(theRect, 4)))
- R = unionVisRect(_me, r1, r2)
- end if
- if (theRect.left > 0) and (theRect.top = 0) then
- r1 = getVisRect(pColumnHeader, rect(getAt(theRect, 1), 1, getAt(theRect, 3), 1))
- r2 = getVisRect(pBody, rect(getAt(theRect, 1), 1, getAt(theRect, 3), getAt(theRect, 4)))
- R = unionVisRect(_me, r1, r2)
- end if
- if (theRect.left = 0) and (theRect.top = 0) then
- r1 = getVisRect(pCorner, rect(1, 1, 1, 1))
- if (theRect.right = 0) and (theRect.bottom = 0) then
- nothing()
- else
- if theRect.right = 0 then
- r2 = getVisRect(pRowHeader, rect(1, getAt(theRect, 2), 1, getAt(theRect, 4)))
- else
- if theRect.bottom = 0 then
- r2 = getVisRect(pColumnHeader, rect(getAt(theRect, 1), 1, getAt(theRect, 3), 1))
- else
- r2 = getVisRect(pBody, rect(1, 1, getAt(theRect, 3), getAt(theRect, 4)))
- r3 = getVisRect(pRowHeader, rect(1, getAt(theRect, 2), 1, getAt(theRect, 4)))
- r4 = getVisRect(pColumnHeader, rect(getAt(theRect, 1), 1, getAt(theRect, 3), 1))
- r2 = unionVisRect(_me, r2, r3)
- r2 = unionVisRect(_me, r2, r4)
- end if
- end if
- end if
- R = unionVisRect(_me, r1, r2)
- end if
- end if
- return R
- end
-
- on unionVisRect me, rect1, rect2
- R = rect(0, 0, 0, 0)
- if voidp(rect1) or (rect1 = rect(0, 0, 0, 0)) then
- return rect2
- else
- if voidp(rect2) or (rect2 = rect(0, 0, 0, 0)) then
- return rect1
- else
- return union(rect1, rect2)
- end if
- end if
- end
-
- on MapCharsToPlatform me
- MapCharsToPlatform(pRowHeader)
- MapCharsToPlatform(pBody)
- return me
- end
-
- on GetScrollNeeds me
- return GetScrollNeeds(pBody)
- end
-
- on setOnStageRectList me, Var
- pOnStageRectList = Var
- end
-
- on GetOnStageRectList me
- return pOnStageRectList
- end
-
- on SizeTable me, size
- if size = 1 then
- SetTableMin(me)
- else
- if getaProp(pScrollNeedsList, #h) or getaProp(pScrollNeedsList, #v) then
- MyObj = getaProp(gDBTableVarList, GetObjProp())
- SpriteList = GetSpriteList(MyObj)
- if getaProp(pScrollNeedsList, #h) then
- xMax = GetMaxVisibleXPixel(pBody, 604)
- end if
- if getaProp(pScrollNeedsList, #v) then
- yMax = 384 - member(the member of sprite getaProp(SpriteList, #Footnote)).height
- yMax = GetMaxVisibleYPixel(pBody, yMax)
- end if
- SetTableMax(me, xMax, yMax)
- end if
- end if
- disable(pCopyButtonObj)
- end
-
- on SetTableMin me
- EvalSetTableMin(pSpanHeader)
- SetTableMin(pColumnHeader)
- SetTableMin(pRowHeader)
- SetTableMin(pBody)
- return me
- end
-
- on SetTableMax me, xMax, yMax
- if not voidp(xMax) then
- EvalSetTableMax(pSpanHeader, xMax)
- SetTableMax(pColumnHeader, xMax)
- end if
- SetTableMax(pRowHeader, xMax, yMax)
- SetTableMax(pBody, xMax, yMax)
- end
-
- on GetSpanCornerNewRect me
- return GetNewRect(pSpanCorner)
- end
-
- on GetSpanHeaderNewRect me
- return GetNewRect(pSpanHeader)
- end
-
- on GetCornerNewRect me
- return GetNewRect(pCorner)
- end
-
- on GetColumnHeaderNewRect me
- return GetNewRect(pColumnHeader)
- end
-
- on GetRowHeaderNewRect me
- return GetNewRect(pRowHeader)
- end
-
- on GetBodyNewRect me
- return GetNewRect(pBody)
- end
-
- on buttonLoc me
- return me
- end
-
- on checkIfSelected me
- return pSelectionRect <> rect(-1, -1, -1, -1)
- end
-
- on getSelectedData me
- if pSelectionRect <> rect(-1, -1, -1, -1) then
- dataList = []
- append(dataList, pSelectionRect)
- if (pSelectionRect.left > 0) and (pSelectionRect.top > 0) then
- append(dataList, getSelectedData(pBody, pSelectionRect))
- else
- if (pSelectionRect.left > 0) and (pSelectionRect.top = 0) then
- data = getSelectedData(pColumnHeader, rect(getAt(pSelectionRect, 1), 1, getAt(pSelectionRect, 3), 1))
- data = quickUnion(data, getSelectedData(pBody, rect(getAt(pSelectionRect, 1), 1, getAt(pSelectionRect, 3), getAt(pSelectionRect, 4))))
- append(dataList, data)
- else
- if (pSelectionRect.left = 0) and (pSelectionRect.top > 0) then
- data = []
- rowData = getSelectedData(pRowHeader, rect(1, getAt(pSelectionRect, 2), 1, getAt(pSelectionRect, 4)))
- bodyData = getSelectedData(pBody, rect(1, getAt(pSelectionRect, 2), getAt(pSelectionRect, 3), getAt(pSelectionRect, 4)))
- numRows = getAt(pSelectionRect, 4) - getAt(pSelectionRect, 2) + 1
- numCols = getAt(pSelectionRect, 3)
- repeat with i = 1 to numRows
- append(data, getAt(rowData, i))
- repeat with j = 1 to numCols
- append(data, getAt(bodyData, ((i - 1) * numCols) + j))
- end repeat
- end repeat
- append(dataList, data)
- else
- data = getSelectedData(pCorner, rect(1, 1, 1, 1))
- data = quickUnion(data, getSelectedData(pColumnHeader, rect(1, 1, getAt(pSelectionRect, 3), 1)))
- rowData = getSelectedData(pRowHeader, rect(1, 1, 1, getAt(pSelectionRect, 4)))
- bodyData = getSelectedData(pBody, rect(1, 1, getAt(pSelectionRect, 3), getAt(pSelectionRect, 4)))
- numRows = getAt(pSelectionRect, 4)
- numCols = getAt(pSelectionRect, 3)
- repeat with i = 1 to numRows
- append(data, getAt(rowData, i))
- repeat with j = 1 to numCols
- append(data, getAt(bodyData, ((i - 1) * numCols) + j))
- end repeat
- end repeat
- append(dataList, data)
- end if
- end if
- end if
- end if
- return dataList
- end
-